package com.security.core.validate.code.image;

import javax.imageio.ImageIO;

import org.springframework.stereotype.Component;
import org.springframework.web.context.request.ServletWebRequest;

import com.security.core.validate.code.impl.AbstractValidateCodeProcessor;

/**
 * @title ImageCodeProcessor
 * @version 1.0.0
 * @description 图片验证码生成
 * @author Dark_blue
 * @date 2019年8月12日
 */
@Component("imageCodeProcessor")
public class ImageCodeProcessor extends AbstractValidateCodeProcessor<ImageCode>{

	@Override
	protected void send(ServletWebRequest request, ImageCode imageCode) throws Exception {
		ImageIO.write(imageCode.getImage(), "JPEG", request.getResponse().getOutputStream());
	}
}
